package com.demo.mykotlin.activity

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import com.demo.mykotlin.R
import kotlinx.android.synthetic.main.activity_second.*
import kotlinx.android.synthetic.main.include_title.*

/**
 * 第二页面
 * 导入布局include
 */
class SecondActivity : BaseActivity(), View.OnClickListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)
        supportActionBar?.hide()

        backBtn.setOnClickListener(this)
        jumpNextPageBtn.setOnClickListener(this)
        button.setOnClickListener(this)
        button2.setOnClickListener(this)
        button4.setOnClickListener(this)

        val titleStr = titleV.getTitle();
        Log.d("TAG", "设置的标题是:${titleStr}")
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.backBtn -> {
                finish()
            }
            R.id.jumpNextPageBtn -> run {
                val intent = Intent(this, ListActivity::class.java);
                startActivity(intent)
            }
            R.id.button -> run {
                val intent = Intent(this, List2Activity::class.java);
                startActivity(intent)
            }
            R.id.button2 -> run {
                RecycleActivity.actionStart(this)
            }
            R.id.button4 -> run {
                val intent = Intent(this, ChatActivity::class.java);
                startActivity(intent)
            }
        }
    }
}
